package com.wsh.archive.enums;

/**
 * 
 * @author Wiltenburg, W. - <a href="wsh.cezar@gmail.com">washington at wshSystems</a>
 * @since 2012, January.
 * @version 1.0	
 */
public enum TypeArchiveKey implements BaseKey {

	PDF(1, ".pdf"),
	XLS(2, ".xls"),
	DOC(3, ".doc"),
	TXT(4, ".txt");
	
	private int codigo;
	private String value;
	
	/**
	 * Constructor.
	 * 
	 * @param codigo
	 * @param value
	 */
	private TypeArchiveKey(final int codigo, final String value) {
		this.codigo = codigo;
		this.value = value;
	}
	
	/**
	 * Encontra o valor conforme o codigo.
	 * 
	 * @param codigo
	 * @return value the enum
	 */
	public static TypeArchiveKey valueForCodigo(int codigo) {
		for (TypeArchiveKey key : TypeArchiveKey.values()) {
			if (key.codigo == codigo) {
				return key;
			}
		}
		return null;
	}

	/**
	 * {@inheritDoc}
	 */
	public int getCodigo() {		
		return codigo;
	}
	
	/**
	 * {@inheritDoc}
	 */
	public String getValue() {		
		return value;
	}
		
	@Override
	public String toString() {
		return this.value;
	}
	
}